home *** CD-ROM | disk | FTP | other *** search
/ Scene Storm / Scene Storm - Volume 1.iso / coding / asm / utils / crossword / includes / cwdiscbuttons.i < prev    next >
Encoding:
Text File  |  1980-01-04  |  4.0 KB  |  229 lines

  1.  
  2.  
  3. * This table is conditioned by the various function
  4. * selection gadgets by calling SetButtons() below with
  5. * an entry value in d0.
  6.  
  7.  
  8. ButtonInfo    dc.w    0,0,0,0,0,0
  9.  
  10.  
  11.  
  12. * These entry points for the function gadgets select a function
  13. * & set the appropriate bits in the file_flags before calling
  14. * SetButtons() below.
  15.  
  16.  
  17. FNLoad        moveq    #0,d0
  18.         bra.s    SetButtons
  19.  
  20. FNSave        moveq    #1,d0
  21.         bra.s    SetButtons
  22.  
  23. FNRename        moveq    #2,d0
  24.         bra.s    SetButtons
  25.  
  26. FNDelete        moveq    #3,d0
  27.         bra.s    SetButtons
  28.  
  29. FNFormat        moveq    #4,d0
  30.         bra.s    SetButtons
  31.  
  32. FNMakeDir    moveq    #5,d0        ;this one just falls through
  33.  
  34.  
  35. * SetButtons(a6,d0)
  36. * a6 = ptr to main program variables
  37. * d0 = entry value from gadget
  38.  
  39. * Condition the buttons for function selection.
  40. * This allows the user to press Load, say, then
  41. * press Save and have Load released. Note that
  42. * the gadget responsible for calling this routine
  43. * has its own state left unchanged.
  44.  
  45. * 'Parent' gadget skipped.
  46.  
  47. * d0-d3/a0-a2 corrupt
  48.  
  49.  
  50. SetButtons    move.w    d0,-(sp)        ;save gadget number
  51.  
  52.         neg.w    d0
  53.         addq.w    #7,d0
  54.  
  55.         moveq    #0,d1        ;this ensures all other
  56.         bset    d0,d1        ;function flags are
  57.         and.b    d1,file_flag1(a6)    ;killed off
  58.  
  59.         bchg    d0,file_flag1(a6)    ;set function flags
  60.  
  61.         lea    ND_Load(pc),a1
  62.         move.l    dp_window1(a6),a0
  63.         moveq    #7,d0        ;unlink this many
  64.  
  65.         CALLINT    RemoveGList
  66.  
  67.         move.w    (sp)+,d0
  68.  
  69.         move.w    #SELECTED,d1    ;toggle flag
  70.         not.w    d1        ;this kills SELECTED off
  71.  
  72.         lea    ButtonInfo(pc),a0    ;ptr to change table
  73.         moveq    #6,d2        ;no. to do
  74.  
  75. SBut_1        move.w    d1,d3        ;copy turnoff mask
  76.         tst.w    d0        ;this gadget called it?
  77.         bne.s    SBut_2        ;skip if not
  78.         moveq    #-1,d3        ;else use this mask
  79. SBut_2        move.w    d3,(a0)+        ;pop in mask
  80.         subq.w    #1,d0        ;find next func gadget
  81.         subq.w    #1,d2        ;done them all?
  82.         bne.s    SBut_1        ;back if not
  83.  
  84.         lea    ND_Load(pc),a0    ;point to 1st gadget
  85.         lea    ND_Parent(pc),a1    ;this one to skip
  86.         lea    ButtonInfo(pc),a2    ;mask table
  87.         moveq    #6,d0        ;no. to do
  88.  
  89. SBut_3        cmp.l    a1,a0        ;hit skip gadget?
  90.         bne.s    SBut_4        ;skip if not
  91.         move.l    (a0),a0        ;else pick next gadget
  92.  
  93. SBut_4        move.w    gg_Flags(a0),d1    ;get current flags
  94.         and.w    (a2)+,d1        ;kill off SELECTED?
  95.         move.w    d1,gg_Flags(a0)
  96.  
  97.         move.l    (a0),a0        ;get next gadget
  98.         subq.w    #1,d0        ;done them all?
  99.         bne.s    SBut_3        ;back if not
  100.  
  101.         lea    ND_Load(pc),a1
  102.         move.l    dp_window1(a6),a0
  103.         sub.l    a2,a2
  104.         moveq    #4,d0
  105.         moveq    #7,d1
  106.  
  107.         CALLINT    AddGList        ;link gadgets back in
  108.  
  109.         lea    ND_Load(pc),a0
  110.         move.l    dp_window1(a6),a1
  111.         sub.l    a2,a2
  112.         moveq    #7,d0
  113.  
  114.         CALLINT    RefreshGList
  115.  
  116.         rts
  117.  
  118.  
  119. * CancelButtons(a6)
  120. * a6 = ptr to main program variables
  121. * If any of the function gadgets are set, this clears them
  122. * upon pressing the Cancel gadget.
  123.  
  124. * d0-d2/a0-a2 corrupt
  125.  
  126.  
  127. CancelButtons    lea    ND_Load(pc),a1
  128.         move.l    dp_window1(a6),a0
  129.         moveq    #7,d0
  130.  
  131.         CALLINT    RemoveGList
  132.  
  133.         move.w    #SELECTED,d0
  134.         not.w    d0
  135.  
  136.         lea    ND_Load(pc),a0
  137.         lea    ND_Parent(pc),a1
  138.         moveq    #6,d1
  139.  
  140. CBT_1        cmp.l    a0,a1        ;hit Parent gadget?
  141.         bne.s    CBT_2        ;skip if not
  142.         move.l    (a0),a0        ;else get next gadget
  143.  
  144. CBT_2        and.w    d0,gg_Flags(a0)    ;kill SELECTED state
  145.  
  146.         move.l    (a0),a0        ;get next gadget
  147.         subq.l    #1,d1        ;done them all?
  148.         bne.s    CBT_1
  149.  
  150.         lea    ND_Load(pc),a1
  151.         move.l    dp_window1(a6),a0
  152.         sub.l    a2,a2
  153.         moveq    #4,d0
  154.         moveq    #7,d1
  155.  
  156.         CALLINT    AddGList
  157.  
  158.         lea    ND_Load(pc),a0
  159.         move.l    dp_window1(a6),a1
  160.         sub.l    a2,a2
  161.         moveq    #7,d0
  162.  
  163.         CALLINT    RefreshGList
  164.  
  165.         clr.b    file_flag1(a6)
  166.  
  167.         rts
  168.  
  169.  
  170. * FNEnact(a6)
  171. * a6 = ptr to main program variables
  172.  
  173. * Enact the function selected, then clear all the gadgets a la
  174. * the Cancel gadget.
  175.  
  176. * ASSUME ALL REGISTERS CORRUPT!
  177.  
  178.  
  179. FNEnact        move.b    file_flag1(a6),d0    ;get function flags
  180.  
  181.         lsl.b    #1,d0
  182.         bcc.s    FNEN_1
  183.         bsr    LoadFile
  184.         bra.s    FNEN_6
  185.  
  186. FNEN_1        lsl.b    #1,d0
  187.         bcc.s    FNEN_2
  188.         bsr    SaveFile
  189.         bra.s    FNEN_6
  190.  
  191. FNEN_2        lsl.b    #1,d0
  192.         bcc.s    FNEN_3
  193.         bsr    UserRename
  194.         bra.s    FNEN_6
  195.  
  196. FNEN_3        lsl.b    #1,d0
  197.         bcc.s    FNEN_4
  198.         bsr    UserDelete
  199.         bra.s    FNEN_6
  200.  
  201. FNEN_4        lsl.b    #1,d0
  202.         bcc.s    FNEN_5
  203.         bsr    UserFormat
  204.         bra.s    FNEN_6
  205.  
  206. FNEN_5        lsl.b    #1,d0
  207.         bcc.s    FNEN_6
  208.         bsr    UserMakeDir
  209.  
  210. FNEN_6        bsr    CancelButtons
  211.         rts
  212.  
  213.  
  214. * This code is called whenever a DISKINSERTED or DISKREMOVED
  215. * IDCMP message is received. It checks which floppy disc drive
  216. * (Drive 0, Drive 1) 
  217.  
  218.  
  219. OutDrive        nop
  220.         rts
  221.  
  222.  
  223. InDrive        nop
  224.         rts
  225.  
  226.  
  227.  
  228.  
  229.